<?php

declare(strict_types=1);

namespace App\CustHub\Listener;

use App\CustHub\Event\SmartTagRoomBehaviorTrigger;
use App\CustHub\Service\ChSmartTagRuleService;
use Hyperf\Event\Annotation\Listener;
use Hyperf\Event\Contract\ListenerInterface;
use Psr\Container\ContainerInterface;

#[Listener]
class SmartTagRoomBehaviorListener implements ListenerInterface
{

    protected $container;

    public function __construct(ContainerInterface $container)
    {
        $this->container = $container;
    }

    public function listen(): array
    {
        // 返回一个该监听器要监听的事件数组，可以同时监听多个事件
        return [
            SmartTagRoomBehaviorTrigger::class,
        ];
    }

    public function process(object $event): void
    {
        //社群行为智能标签
        container()->get(ChSmartTagRuleService::class)->roomRuleHandler($event->robotId,$event->userId,$event->roomWxid);
    }

}